/*************************************************************************
	> File Name: P1294.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2024-12-17 13:00:22
 ************************************************************************/
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

#define MAX_N 20
int grid[MAX_N + 5][MAX_N + 5];
int visit[MAX_N + 5];
int n, m, ans = 0, sum = 0;

void dfs(int i) {
    for (int j = 1; j <= n; j++) {
        if (visit[j]) continue;
        if (grid[i][j] == 0) continue;
        visit[j] = 1;
        sum += grid[i][j];
        dfs(j);
        sum -= grid[i][j];
        visit[j] = 0;
    }
    if (sum > ans) ans = sum;
    return ;
}

int main () {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        grid[a][b] = c;
        grid[b][a] = c;
    }
    for (int i = 1; i <= n; i++) {
        visit[i] = 1;
        dfs(i);
        visit[i] = 0;
    }
    cout << ans << endl;
    return 0;
}
